<?php
/**
 * 修改信息模板.
 * User: lvshuyun
 * Date: 2015/6/11
 * Time: 10:18
 */
use common\widgets\Box;
use kartik\builder\Form;
use kartik\widgets\ActiveForm;
use yii\helpers\Html;

$this->title = '修改微信推送消息';

//todo 缩略图上传需要精细化，优化

Box::begin([
    'title' => '修改微信推送消息',
    'buttons' => [
        ['text'=>'微信推送消息列表', 'href'=>'/wechat/send.html', 'icon'=>'list'],
        ['text'=>'添加信息', 'href'=>'/wechat/send-add.html', 'icon'=>'plus'],
    ]
]);

$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_VERTICAL, 'method'=>'post']);

echo Form::widget([
    'model'=>$model,
    'form'=>$form,
    'columns'=>1,
    'attributes'=>[       // 2 column layout
        'title'=>['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'标题...']],
        'desc'=>['type'=>Form::INPUT_TEXTAREA, 'options'=>['placeholder'=>'描述...']],
        'remark'=>['type'=>Form::INPUT_TEXTAREA, 'options'=>['placeholder'=>'备注...']],
        'url'=>['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'链接地址...']],
    ]
]);

echo Form::widget([
    'model'=>$model,
    'form'=>$form,
    'columns'=>2,
    'attributes'=>[       // 2 column layout
        'money'=>['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'金额...']],
        'time'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>[0=>'--请选择时间--', 1=>'早', 2=>'中', 3=>'晚']],
    ]
]);

echo Form::widget([       // 3 column layout
    'model'=>$model,
    'form'=>$form,
    'columns'=>2,
    'attributes'=>[
        'startTime'=>[
            'type'=>Form::INPUT_WIDGET,
            'widgetClass'=>'\kartik\widgets\DateTimePicker',
            'options' => [
                'pluginOptions' => ['displayFormat' => 'yyyy-MM-dd HH:mm', 'autoclose' => true]
            ],
        ],
        'endTime'=>[
            'type'=>Form::INPUT_WIDGET,
            'widgetClass'=>'\kartik\widgets\DateTimePicker',
            'options' => [
                'pluginOptions' => ['displayFormat' => 'yyyy-MM-dd HH:mm', 'autoclose' => true]
            ],
        ],
    ]
]);

echo Form::widget([
    'model'=>$model,
    'form'=>$form,
    'columns'=>1,
    'attributes'=>[
        'actions'=>[
            'type'=>Form::INPUT_RAW,
            'value'=>'<div style="text-align: right; margin-top: 20px">' .
                Html::resetButton('重置', ['class'=>'btn btn-default']) . ' ' .
                Html::submitButton('提交', ['class'=>'btn btn-primary']) .
                '</div>'
        ],
    ]
]);
ActiveForm::end();

Box::end();






